package com.learning.javaweb_springboot_page_query.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.learning.javaweb_springboot_page_query.entity.User;
import com.learning.javaweb_springboot_page_query.mapper.UserMapper;
import com.learning.javaweb_springboot_page_query.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    //通过id查询
    @Override
    public User queryUserById(Integer id) {
        return userMapper.selectById1(id);
    }

    //条件查询，所有用户
    @Override
    public List<User> queryAllUser() {
        QueryWrapper queryWrapper = new QueryWrapper();//自带条件查询函数
        return userMapper.selectList(queryWrapper);
    }
}
